package com.vint.leetcode;

import java.util.ArrayList;
import java.util.List;

/*
 * 1. 自除数，简单
 */
public class Leetcode728 {
	public List<Integer> selfDividingNumbers(int left, int right) {
		List<Integer> ret = new ArrayList<>();
		for(int i = left; i <= right; i++) {
			if (isSelfDividingDigit(i)) {
				ret.add(i);
			}
		}
		return ret;
	}
	boolean isSelfDividingDigit(int n) {
		if(String.valueOf(n).contains("0")) {
			return false;
		}
		int src = n;
		while (n!=0) {
			int div = n % 10;
			if (src % div!=0) {
				return false;
			}
			n /= 10;
		}
		return true;
	}
    public static void main(String[] args) {
    }
  }
